package com.zb.vo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zb.entity.ZjCodeRegSet;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Bean;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @Author WEN
 * @Date 2023/7/26 0026
 **/
@Data
@ApiModel("编码登记设置实体封装")
public class CodeRegSetVo {
    @NotNull(message = "编码登记ID不能为空")
    @ApiModelProperty(value = "编码登记ID，必传", required = true, example = "")
    private Long id;

    @NotNull(message = "是否登记选项不能为空")
    @ApiModelProperty(value = "是否登记：false-否，true-是", required = true, example = "true")
    private Boolean register;

    @ApiModelProperty(value = "创建时间", hidden = true)
    private Date createTime;

    @ApiModelProperty(value = "更新时间", hidden = true)
    private Date updateTime;

    public static CodeRegSetVo beanToVo(ZjCodeRegSet regSet) {
        CodeRegSetVo vo = new CodeRegSetVo();
        BeanUtils.copyProperties(regSet, vo);
        vo.setCreateTime(regSet.getGmtCreate());
        vo.setUpdateTime(regSet.getGmtUpdate());
        return vo;
    }

    public static ZjCodeRegSet voToBean(CodeRegSetVo vo) {
        ZjCodeRegSet regSet = new ZjCodeRegSet();
        BeanUtils.copyProperties(vo, regSet);
        return regSet;
    }
}
